﻿@model IEnumerable<EdexApiClient.Invoices>

<table class="table table-striped zebra-striped tablesorter">
    <thead>
        <tr>
            <th></th>
            <th>Поставщик</th>
            <th>Склад</th>
            <th>Дата документа</th>
            <th>№ документа</th>
            <th>Сумма</th>
            <th>№ в УС</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var record in Model) {
            var tr_class = (record.LINES.Any(r => !r.ITEM_GUID.HasValue) || !record.LOCATION_GUID.HasValue) ? "error" : String.Empty;
        <tr data-index="@record.GUID_RECORD" class="@tr_class">
            <td data-type="noclick"><input type="checkbox" name="SELECTED_GUID_RECORD" value="@record.GUID_RECORD" checked="checked" /></td>
            <td>@(record.COMPANY != null ? record.COMPANY.COMPANY_NAME : String.Empty)</td>
            <td>@(record.LOCATION != null ? record.LOCATION.LOCATION_NAME : String.Empty)</td>
            <td>@record.DOC_DATE.ToShortDateString()</td>
            <td>@record.DOC_NUMBER</td>
            <td>@record.TOTAL_AMOUNT</td>
            <td>@record.DOC_ID</td>
        </tr>
        }
    </tbody>
</table>